package zhongbo.javaweb.instagram.config;

import org.springframework.boot.web.server.MimeMappings;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Configuration;

/**
 * 说明：
 * <p>
 * 自定义vue mime文件类型
 *
 * @author zhongboWork
 * @version 1.0
 * @since 2021-12-22 10:30
 * @see <a href="https://leaderli.github.io/2019/08/02/springboot%E9%9D%99%E6%80%81%E8%B5%84%E6%BA%90%E5%AE%9A%E4%B9%89mime%E7%B1%BB%E5%9E%8B/">springboot静态资源定义mime类型</a>
 */
@Configuration
public class VueMimeMapping implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {

    @Override
    public void customize(ConfigurableServletWebServerFactory factory) {
        MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
        mappings.add("vue", "text/javascript");
        factory.setMimeMappings(mappings);
    }
}
